/**
 * 文章相关模型定义
 */

// 文章基本信息接口
export interface Post {
  id: number;
  title: string;
  content: string;
  abstractInfo: string;
  goodsNum: number;
  favoursNum: number;
  createBy: number;
  createTime: string;
  updateTime: string;
  categoryId?: number; // 添加分类ID字段
  coverImage?: string; // 文章封面图片
}

// 文章分页响应接口
export interface PostPageResponse {
  records: Post[];
  total: number;
  size: number;
  current: number;
  pages: number;
}

// 文章详情接口
export interface PostDetail extends Post {
  tags?: string[];
  category?: string;
  viewCount?: number;
  commentCount?: number;
}

// 文章详情及统计信息
export interface PostDetailWithStats extends PostDetail {
  likeCount: number;
  favouriteCount: number;
  isLiked: boolean;
  isFavourited: boolean;
}

// 评论相关接口
export interface Comment {
  id: number;
  postId: number;
  userId: number;
  parentId?: number;
  content: string;
  createTime: string;
  updateTime: string;
  replyCount: number;
  user: {
    id: number;
    username: string;
    avatar?: string;
  };
  replies?: Comment[];
}

// 评论请求参数
export interface CommentRequest {
  postId: number;
  content: string;
  parentId?: number;
}

// 点赞/收藏请求参数
export interface ToggleRequest {
  postId: number;
}

// 点赞/收藏响应
export interface ToggleResponse {
  success: boolean;
  isActive: boolean;
  count: number;
}